<template>
	<view  class="News">
		
		
		<newlist  :list="newList"  @itemClick ="goDetil"   ></newlist>
	</view>
</template>
      
<script>
	
	 import  newlist  from  "../../components/news-item/news-item.vue"
	export default{
		
		data(){
			return{
				
				newList:[],
				img_url:"https://img0.baidu.com/it/u=1572114175,2890797156&fm=253&fmt=auto&app=138&f=GIF?w=484&h=558"
			}
		},
		 components:{
			  newlist : newlist
		 },
		methods:{
			async  getNew(){
				// 5、获取资讯列表
				const  res = await  this.$myRequest({
					url:'/api/getnewslist'
				})
				
				this.newList = res.data.message.map((it)=>{

						  it.img_url  =  this.img_url
						   return	it
				})
			},
			goDetil(id){
				
				
				 uni.navigateTo({
				 	url:'/pages/new-detail/new-detail?id=' + id 
				 })
			}
		},
		onLoad() {
			this.getNew()
		}
	}
</script>

<style  lang="scss" scoped>
	
	  .News{
		  
		  
	  }
</style>